package com.jlu155.CourseManager.Bean;

import java.util.List;

public class PageResult<T> {
    List<T> pageList;
    int pageNumber;

    public List<T> getPageList() {
        return pageList;
    }

    public void setPageList(List<T> pageList) {
        this.pageList = pageList;
    }

    public int getPageNumber() {
        return pageNumber;
    }

    public void setPageNumber(int pageNumber) {
        this.pageNumber = pageNumber;
    }

    public void cutPage(int index, int pageSize){
        int startIndex=(index-1)*pageSize;
        int endIndex=Math.min(startIndex+pageSize,pageList.size());
        pageNumber=pageList.size();
        pageList=pageList.subList(startIndex,endIndex);
    }
}
